package com.lj.graduate.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lj.graduate.common.Result;
import com.lj.graduate.controller.dto.FeedbackDTO;
import com.lj.graduate.controller.dto.ReleaseDetailDTO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.lj.graduate.service.IReleaseDetailService;
import com.lj.graduate.entity.ReleaseDetail;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ljy
 * @since 2023-03-24
 */
@RestController
@RequestMapping("/release-detail")
        public class ReleaseDetailController {
    
@Resource
private IReleaseDetailService releaseDetailService;

// 新增或者更新
@PostMapping
public boolean save(@RequestBody ReleaseDetail releaseDetail) {
        return releaseDetailService.saveOrUpdate(releaseDetail);
        }

@DeleteMapping("/{id}")
public Boolean delete(@PathVariable Integer id) {
        return releaseDetailService.removeById(id);
        }

@PostMapping("/del/batch")
public boolean deleteBatch(@RequestBody List<Integer> ids) {
        return releaseDetailService.removeByIds(ids);
        }

@GetMapping
public List<ReleaseDetail> findAll() {
        return releaseDetailService.list();
        }

@GetMapping("/{id}")
public ReleaseDetail findOne(@PathVariable Integer id) {
        return releaseDetailService.getById(id);
        }

        @GetMapping("/page")
        public Result selectPage(@RequestParam Integer pageNum,
                                 @RequestParam Integer pageSize,
                                 @RequestParam String userName
        ){

                pageNum = (pageNum - 1) * pageSize;
                List<ReleaseDetailDTO> sysUserIPage = releaseDetailService.selecetPage(pageNum,pageSize);

                return Result.success(sysUserIPage);


        }

        }

